﻿
 
@{
    ViewBag.Title = "平台配置";
    var dict = (Dictionary<Int32, IList<Service.Infrastructure.Model.SettingConfigModel>>)TempData["Data"];
    var emailList = dict[Service.Infrastructure.EnvirType.Mail];
    var otherList = dict[Service.Infrastructure.EnvirType.Other];
}
<!-- CSS:http://v3.bootcss.com/css/#forms-example -->
<!-- BEGIN EMAIL CONFIG -->
<div class="col-md-6">
    <div class="portlet-body form">
        <div class="portlet box red">
            <div class="portlet-title">
                <div class="caption">
                    <i class="fa fa-envelope"></i> 邮件服务配置
                </div>
                <div class="tools">

                    <a data-toggle="modal" class="config"></a>

                    <a href="#" class="collapse"></a>
                    <a href="#" class="remove"></a>
                </div>
            </div>
            <div class="portlet-body form">
                <form class="form-horizontal" role="form">
                    <div class="form-body">
                        @foreach (var obj in emailList)
                        {
                            if (obj.Type == "1000")
                            {

                        <div class="form-group">
                            <label class="col-md-3 control-label">@obj.Key</label>

                            <!--<label class="sr-only" for="@obj.Key" >@obj.Value</label>  -->
                            <div class="col-md-9">
                                <input type="email" class="form-control" name="@obj.Key" id="@obj.Key" placeholder="@obj.Value">
                            </div>
                        </div>
                            }
                        }

                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- END EMAIL CONFIG-->


<div class="col-md-6">
    <!-- BEGIN OTHER CONFIG-->
    <div class="portlet-body form">
        <div class="portlet box yellow">
            <div class="portlet-title">
                <div class="caption">
                    <i class="fa fa-reorder"></i> 其他配置
                </div>
                <div class="tools">
                    <a href="#" data-toggle="modal" class="config"></a>

                    <a href="#" class="collapse"></a>

                    <a href="#" class="remove"></a>
                </div>
            </div>
            <div class="portlet-body form">
                <form class="form-horizontal" role="form">
                    <div class="form-body">
                        @foreach (var obj in otherList)
                        {

                            <div class="form-group">
                                <label class="col-md-3 control-label">@obj.Key</label>

                                <!--<label class="sr-only" for="@obj.Key" >@obj.Value</label>  -->
                                <div class="col-md-9">
                                    <input type="email" class="form-control" name="@obj.Key" placeholder="@obj.Value">
                                </div>
                            </div>

                        }

                    </div>
                </form>
            </div>
        </div>
    </div>
    <!-- END OTHER CONFIG-->

</div>
@section FootPlugin{

    <script type="text/javascript">
        $(function() {
            /**/
            $(".config").click(function changeConfig() {

                var serializeData = $(this).parents(".portlet-title").siblings(".portlet-body").children(".form-horizontal").serialize();
                $.ajax({
                    url: '@Url.Action("ChangeConfig", "Admin")',
                    type: 'POST',
                    data: serializeData,
                }).done(function(data) {
                    if (data.ReCode == 3003) {
                        alert("更新成功");
                    }
                });
            });

        });

    </script>
}